]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ci: Use script from tools to run eslint
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 10 Jun 2025 01:15:21 +0000 (03:15 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 30 Jul 2025 14:27:19 +0000 (14:27 +0000)
Now that we include a more public version of the script, there
is no reason to keep the original script just for CI.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3746>

.gitlab-ci.yml
.gitlab-ci/run-eslint [deleted file]

index 5a935f6bdc23ffd37bd657b4028601e86678e4c7..683b217f19e3aa55f0005a1cfa7fa3d58a0ff26d 100644 (file)
@@ -142,8 +142,7 @@ eslint:
   variables:
     LINT_LOG: "eslint-report.xml"
   script:
-    - export NODE_PATH=$(npm root -g)
-    - ./.gitlab-ci/run-eslint --output-file ${LINT_LOG} --format junit --stdout
+    - ./tools/run-eslint.sh --output-file ${LINT_LOG} --format junit --stdout
   artifacts:
     reports:
       junit: ${LINT_LOG}
diff --git a/.gitlab-ci/run-eslint b/.gitlab-ci/run-eslint
deleted file mode 100755 (executable)
index c7802ed..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env node
-
-const {ESLint} = require('eslint');
-
-console.log(`Running ESLint version ${ESLint.version}...`);
-
-const fs = require('fs');
-const path = require('path');
-
-function hasOption(...names) {
-    return process.argv.some(arg => names.includes(arg));
-}
-
-function getOption(...names) {
-    const optIndex =
-        process.argv.findIndex(arg => names.includes(arg)) + 1;
-
-    if (optIndex === 0)
-        return undefined;
-
-    return process.argv[optIndex];
-}
-
-(async function main() {
-    const outputOption = getOption('--output-file', '-o');
-    const outputPath = outputOption ? path.resolve(outputOption) : null;
-
-    const sourceDir = path.dirname(process.argv[1]);
-    process.chdir(path.resolve(sourceDir, '..'));
-
-    const sources = ['js', 'subprojects/extensions-app/js', 'tests'];
-    const eslint = new ESLint({cache: true});
-
-    const results = await eslint.lintFiles(sources);
-    const formatter = await eslint.loadFormatter(getOption('--format', '-f'));
-    const resultText = formatter.format(results);
-
-    if (outputPath) {
-        fs.mkdirSync(path.dirname(outputPath), { recursive: true });
-        fs.writeFileSync(outputPath, resultText);
-
-        if (hasOption('--stdout')) {
-            const consoleFormatter = await eslint.loadFormatter();
-            console.log(consoleFormatter.format(results));
-        }
-    } else {
-        console.log(resultText);
-    }
-
-    process.exitCode = results.some(r => r.errorCount > 0) ? 1 : 0;
-})().catch((error) => {
-    process.exitCode = 1;
-    console.error(error);
-});